# 1.导模块
from pptx import Presentation

# 2.创建文稿
from pptx.dml.color import RGBColor
from pptx.util import Pt

pre = Presentation()
from pptx.presentation import Presentation

pre: Presentation = pre

# 3.设置 幻灯片 样式  1号
slide_style = pre.slide_layouts[1]
slide = pre.slides.add_slide(slide_style)

# 4.获取shape--placeholders
shapes = slide.shapes.placeholders
shapes[0].text = '大标题'

# 5.构建  写入的数据
paragraph_strs = [
    '我在马路边捡到一分钱',
    '把它交给警察叔叔手里边',
    '叔叔拿着钱 对我把头点',
    '我高兴的说了声 叔叔再见'
]

# 6.根据 shape取出 text_frame
text_frame = shapes[1].text_frame

print(type(text_frame))

for parastr in paragraph_strs:
    # 7.根据text_frame 取出 paragraph()
    p = text_frame.add_paragraph()

    # 8.设置 para的数据  text
    p.text = parastr

    # 9.设置para的样式
    p.font.name = '楷体'
    p.font.size = Pt(36)
    p.font.bold = True
    p.font.italic = True
    p.font.color.rgb = RGBColor(0xFF, 0x00, 0xF5)

# 保存文稿
pre.save('07content.pptx')

print('写内容 设样式....')
